<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>活动列表</title>
    <link href="https://cdn.bootcss.com/webuploader/0.1.1/webuploader.css" rel="stylesheet" type="text/css"/>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery.form/4.2.1/jquery.form.min.js"></script>
    <script type="text/javascript" src="https://cdn.bootcss.com/webuploader/0.1.1/webuploader.min.js"></script>
</head>
<body>
<a href="/activity/create">创建活动</a>
<ul>
<#list list as o>
    <li>
        <div>${o.name!''}</div>
        <!--dom结构部分-->
        <div id="uploader-demo_${o.id!''}">
            <!--用来存放item-->
            <div id="fileList_${o.id!''}" class="uploader-list"></div>
            <div id="filePicker_${o.id!''}">选择文件</div>
        </div>
        <div>
            <a href="/code/${o.id!''}" target="_blank">查看当前二维码</a>
            <input type="button" value="更换二维码" class="change" myid="${o.id!''}"/>
        </div>
    </li>
</#list>
</ul>
</body>
</html>
<script type="text/javascript">
    <#list list as o>
    WebUploader.create({
        auto: true,
        swf: 'https://cdn.bootcss.com/webuploader/0.1.1/Uploader.swf',
        server: '/upload',
        pick: '#filePicker_${o.id!''}',
        formData: {
            aid:${o.id!''}
        },
        accept: {
            title: 'zip',
            extensions: 'zip',
            mimeTypes: 'application/x-zip-compressed'
        }
    });
    </#list>
    $(".change").click(function () {
        var myid = $(this).attr("myid");
        $.post("/activity/change/" + myid, {}, function () {
            alert("已更换");
        })
    });
</script>